<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>信息管理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__ADMIN__css/style.css"  media="all">
  <link rel="stylesheet" href="__ADMIN__layui/css/layui.css"  media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<div class="pad-20">
  <fieldset class="layui-elem-field layui-field-title">
  <legend>信息管理</legend>
  </fieldset>
  <form class="layui-form" action="" method="post" enctype="multipart/form-data">
    <div class="layui-tab">
      <ul class="layui-tab-title">
        <li class="layui-this">基本信息</li>
        <li>详细内容</li>
      </ul>
      <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
          <!--基本信息-->
          <div class="layui-form-item">
              <label class="layui-form-label"><i class="layui-error-ts">*</i> 栏目分类</label>
              <div class="layui-input-block">
                <select name="data[catid]" lay-verify="required">
                  <option value="">请选择栏目</option>
                  <volist name="category_tree" id="val">
                  <option value="{$val['id']}" <eq name="val['id']" value="$info['catid']">selected=""</eq>>{$val['title']}</option>
                  </volist>
                </select>
              </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label"><i class="layui-error-ts">*</i> 文章标题</label>
            <div class="layui-input-inline" style="width:600px;">
              <input class="layui-input newsName" lay-verify="required" placeholder="请输入文章标题" value="{$info['title']}" type="text" name="data[title]">
            </div>
            <div class="layui-input-inline" style="width:80px;">
              <input class="layui-input newsName" lay-verify="required" value="{$info['sort']|default='0'}" type="text" name="data[sort]">
            </div>
            <div class="layui-form-mid layui-word-aux">权重越小越靠前</div>
          </div>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">自定义属性</label>
              <div class="layui-input-block">
                <input name="data[is_recom]" title="推荐" value="1" <eq name="info['is_recom']" value="1">checked=""</eq> type="checkbox">
                <input name="data[status]" title="审核" value="1" <eq name="info['status']" value="1">checked=""</eq> type="checkbox">
              </div>
            </div>
            <div class="layui-inline">
              <div class="layui-input-inline">
                <input class="layui-input newsAuthor" placeholder="请输入文章作者" value="{$info['author']}" name="data[author]" type="text">
              </div>
            </div>
            <div class="layui-inline">
              <div class="layui-input-inline">
                <input class="layui-input newsAuthor" placeholder="请输入文章来源" value="{$info['source']}" name="data[source]" type="text">
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">发布时间</label>
              <div class="layui-input-inline">
                <input class="layui-input newsTime" id="date" type="text" value="{$info['create_time']|default=date('Y-m-d H:i:s',time())}" name="data[create_time]" readonly>
              </div>
            </div>
          </div>
          <div class="layui-form-item upload-row">
            <label class="layui-form-label">文件上传</label>
            <div class="layui-input-block">
              <input class="layui-input" name="data[thumb]" placeholder="请选择文件上传" type="text" value="{$info['thumb']}" readonly="" style="width:600px;display:inline-block;">
              <button type="button" class="layui-btn buttonup"><i class="layui-icon">&#xe67c;</i>文件浏览</button>
              <notempty name="info['thumb']"><button type="button" class="layui-btn  open-file"><i class="layui-icon">&#xe64a;</i>  查看文件</button>
              <div id="fileurl" style="display:none;"><img src="/Uploads/{$info['thumb']}" style="max-width:590px;"/></div>
              </notempty>
            </div>
          </div>

          <div class="layui-form-item">
            <label class="layui-form-label">SEO关键字</label>
            <div class="layui-input-block">
              <input class="layui-input" name="data[seo_keyword]" placeholder="请输入文章关键字" value="{$info['seo_keyword']}" type="text">
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">内容摘要</label>
            <div class="layui-input-block">
              <textarea placeholder="请输入内容摘要" name="data[description]" class="layui-textarea">{$info['description']}</textarea>
            </div>
          </div>
          <!--基本信息-->
        </div>
        <div class="layui-tab-item">
          <!--文章内容-->
          <div class="layui-form-item">
            <label class="layui-form-label">文章内容</label>
            <div class="layui-input-block">
              <script id="layui-editor" name="data[content]" type="text/plain">{:get_content($info['content'])}</script>
            </div>
          </div>
          <!--文章内容-->
        </div>
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block pad-l-10">
        <input type="hidden" name="id" value="{$info['id']|default=''}">
        <button class="layui-btn" lay-submit="" lay-filter="addNews">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
  </form>
</div>
<div class="yzui-filler"></div>
<script src="__ADMIN__js/jquery-1.9.1.min.js" charset="utf-8"></script>
<script type="text/javascript" src="__COMMON__ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__COMMON__ueditor/ueditor.all.js"></script>
<script src="__ADMIN__layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script type="text/javascript">
  var ue = UE.getEditor('layui-editor');
  layui.use(['form', 'layedit', 'laydate'], function(){
    var form = layui.form,layer = layui.layer,layedit = layui.layedit,laydate = layui.laydate;
    laydate.render({
      elem: '#date',type: 'datetime'
    });
  });
  layui.use('element', function(){
  var $ = layui.jquery
  ,element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
  $('.site-demo-active').on('click', function(){
    var othis = $(this), type = othis.data('type');
    active[type] ? active[type].call(this, othis) : '';
  });

  //Hash地址的定位
  var layid = location.hash.replace(/^#test=/, '');
  element.tabChange('test', layid);
  element.on('tab(test)', function(elem){
    location.hash = 'test='+ $(this).attr('lay-id');
  });
  });
  $(function(){
    // 文件上传
    $(".upload-row").each(function(i){
      $(this).find(".buttonup").click(function(){
        window.open('{:U('Tool/uploadImage', '', '')}?id='+ i, '文件上传', 'height=100, width=400, top='+(screen.availHeight-100)/2+', left='+(screen.availWidth-400)/2+', toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
      });
    });
    $(".open-file").click(function(){
      layer.open({
        type: 1,
        title: false,
        closeBtn: 1,
        skin: 'layui-layer-nobg', //没有背景色
        shadeClose: true,
        content: $('#fileurl')
      });
    });
  });
</script>
</body>
</html>
